#include<iostream>
using namespace std;
class Complex{
	private:
		double real;double imag;
	public:
		Complex(double r=0.0,double i=0.0):real(r),imag(i){}
		friend Complex operator+(const Complex &a, const Complex &b);
        friend Complex operator-(const Complex &a, const Complex &b); 
        void display() const {  
        cout << real << "," << imag << "i" <<endl;
    }  
};
Complex operator+(const Complex &a, const Complex &b){
	return Complex(a.real + b.real, a.imag + b.imag); 
}
Complex operator-(const Complex &a, const Complex &b) {  
    return Complex(a.real - b.real, a.imag - b.imag);}
int main()
{
	Complex a1(1,2);
	Complex b1(3,4);
	Complex a2(5,6);
	Complex b2(7,8);
	Complex c1=a1+b1;
	c1.display();
	Complex c2=a2+b2;
	c2.display();
	Complex d1=a1-b1;
	d1.display();
	Complex d2=a2-b2;
	d2.display();
	return 0;
}
